<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="__EXTEND__/favicon.ico" >
    <link rel="Shortcut Icon" href="__EXTEND__/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__EXTEND__/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__EXTEND__/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <!--_footer 作为公共模版分离出去-->
    <script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="__EXTEND__/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/static/h-ui.admin/js/H-ui.admin.js"></script>
    <!--/_footer /作为公共模版分离出去-->

    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/messages_zh.js"></script>

    <title>操作</title>
</head>
<body>
<article class="page-container">
    <include file="Apply/layout" />
    <form class="form form-horizontal" id="form-edit" >
        <input type="hidden" name="id" value="{{$res['id']}}">
        <input type="hidden" name="p_id" value="{{$res['p_id']}}">
        <if condition="in_array($res['status'],array(6))">
            <div class="row cl">
                <label class="form-label col-xs-2 col-sm-2">审批人：</label>
                <div class="formControls col-xs-9 col-sm-9">
                    <label class="form-label l">{{:get_nickname($res['operator_1'])}}（{{:date("Y-m-d H:i:s",$res["accept_time"])}}）</label>
                </div>
            </div>
        </if>
        <if condition="!in_array($res['status'],array(6)) ">
            <div class="row cl">
                <dl class="permission-list">
                    <dt>
                        <label>选择部门<span style="color:red">(选择下发部门，可多选)</span></label>
                    </dt>
                    <dd>
                        <dl class="cl permission-list2">
                            <dd>
                                <foreach name="departments" item = "department">
                                    <label class="">
                                        <input value="{{$department['id']}}" name="check_depart[]" id="depart_{{$department['id']}}" type="checkbox">{{$department['name']}}
                                    </label>
                                </foreach>
                            </dd>
                        </dl>
                    </dd>
                </dl>
            </div>
        </if>
        <if condition="in_array($res['status'],array(1,6))">
            <div class="row cl">
                <label class="form-label col-xs-2 col-sm-2">拒绝原因：</label>
                <div class="formControls col-xs-9 col-sm-9">
                    <textarea id="refuse_reason" type="text" class="textarea" name="refuse_reason" placeholder="拒绝则先填写拒绝原因">{{$res['refuse_reason']}}</textarea>
                </div>
            </div>
        </if>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <if condition="$res['status'] eq 1">
                    <button class="btn btn-primary radius" type="submit"  name="operate" value="1"><i class="Hui-iconfont">&#xe6a7;</i> 受理下发</button>
                    <button class="btn btn-danger radius" type="submit"  name="operate" value="2"><i class="Hui-iconfont">&#xe6a6;</i> 拒绝</button>
                </if>
                <button  class="btn btn-default radius" onclick="layer_close()">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</article>


<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
        $(".textarea").Huitextarealength({
            minlength:0,
            maxlength:255,
            errorClass:'error',
            exceed:true,
        });

        //表单验证
        $("#form-edit").validate({
            rules: {
            },
            onkeyup: false,
            focusCleanup: true,
            success: "valid",
            submitHandler: function (form) {
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "{{:U('Admin/Apply/ApplyEdit')}}",
                    beforeSend:function(){
                    },
                    success: function (data) {
                        if (data.status) {
                            layer.msg(data.info, {icon: 6, time: 1000});
                            setTimeout((function () {
                                parent.window.location.href="{{:U('Admin/Apply/Apply1List',array('p'=>$p))}}";
                            }), 1500);
                        } else {
                            layer.msg(data.info, {icon: 2, time: 1000});
                        }
                    },
                    error: function (XmlHttpRequest, textStatus, errorThrown) {
                        layer.msg('error!', {icon: 5, time: 1000});
                    }
                });
            }
        });
    })

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>